package ajaxjs.net;

import javax.servlet.http.HttpServletRequest;

public class Cookie {
	public static String getFromCookie(HttpServletRequest req, String key) {
		javax.servlet.http.Cookie[] cookies = req.getCookies();
		String value = "";

		if (cookies != null) {
			for (javax.servlet.http.Cookie cookie : cookies) {
				if (cookie.getName().equals(key))
					value = cookie.getValue();
				// out.println(cookie.getName());
			}
		}

		return value;
	}
}
